package com.fys.markbook.util

import com.fys.markbook.util.C3P0DataSourceFactory.createDataSource
import com.mchange.v2.c3p0.ComboPooledDataSource
import java.sql.Connection
import java.sql.SQLException

/**
 * @Title:
 * @Description:
 * @Author: fanyushuai
 * @Date: 2023/9/26 0:24
 * @Version V1.0
 */
object DatabaseManager {
    private var dataSource: ComboPooledDataSource? = null

    init {
        dataSource = createDataSource()
    }

    @get:Throws(SQLException::class)
    val connection: Connection
        get() = dataSource!!.getConnection()
}
